<!doctype html>
<html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="about:blank"></iframe>
<script>
const iframe = document.querySelector('iframe');

promise_test(async () => {
  const w = iframe.contentWindow;
  const res = await w.fetch('/');
  const body = res.body;
  iframe.remove();

  body.cancel();
}, 'Calling cancel after detaching frame should not cause crash');
</script>
